<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>佣金转余额</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="../css/style.css"/>
		<link rel="stylesheet" href="../css/iconfont.css" />
		<link rel="stylesheet" href="../css/wallet.css" />
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" href="JavaScript:history.go(-1)"></a>
		    <h1 class="mui-title">佣金转余额</h1>
		</header>
		<div class="mui-content yongj_content">
			<div class="yjzye_top"><span class="nam" style="line-height: 21px; padding-top: 10px;">当前<br />佣金</span><span class="iconfont icon-jiantou1"></span><span class="nam">余额</span></div>
		    <div class="tixian_pri">
		    	<p>提现到余额(扣除5%服务费)/可提现佣金：<em id='yongj'></em></p>
		    	<p class="tixian_prinum clearfix">
		    		<label>¥</label>
		    		<input type="text" placeholder="" id='money'  onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"  
    onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'0')}else{this.value=this.value.replace(/\D/g,'')}"/>
		    	</p>
		    </div>
		    <div class="wallet_btn" id='quren'><lable style='color: #fff;'>确认</lable></div>
		</div>
	</body>

</html>
<script src="../js/mui.min.js"></script>

<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/layer/layer.min.js"></script>
<script type="text/javascript" src="../js/app.js"></script>
<script type="text/javascript">
	mui.init()
</script>
<script>
	$(function(){
			$.ajax({
			url: APP.api_url + 'Wallet/index',
			data: {
				token: get_token(),
				uid: getUid()
			},
			success: function(data) {
				
				if(data.code == 200) {
					var json = data.data;
					$("#yongj").text(json.credit3);
				} else {
					console.log(data.msg);
				}
			}
		})
			
			
		$("#quren").click(function(){
			
			var money = $("#money").val();
			if(money<1){
				layer.msg('佣金转余额金额不能小于1');
				return false;
			}
			
			
			$.ajax({
				url: APP.api_url + 'Wallet/yonghj_to_money',
				data: {
						token	: get_token(),
						uid		: getUid(),
						money	: $("#money").val()
				},
				success: function(data) {
					if(data.code == 200) {
						layer.msg('转入余额成功！', {
						  time: 2000 
						}, function(){
							location.href="index.html";
						});

					} else {
						layer.msg(data.msg);
						console.log(data.msg);
					}
				}
			})
		})
			
			
			
	});
</script>